// <copyright file="IRoleService.cs" company="EnterpriseApi">
// Copyright (c) EnterpriseApi. All rights reserved.
// </copyright>

using EnterpriseApi.Models;

namespace EnterpriseApi.Services;

/// <summary>
/// 角色服务接口，定义角色特有的业务逻辑操作
/// </summary>
public interface IRoleService : IService<Role>
{
    /// <summary>
    /// 根据角色名称获取角色
    /// </summary>
    /// <param name="name">角色名称</param>
    /// <returns>角色对象，如果不存在则返回null</returns>
    Task<Role?> GetByNameAsync(string name);

    /// <summary>
    /// 检查角色名称是否已存在
    /// </summary>
    /// <param name="name">角色名称</param>
    /// <returns>角色名称是否已存在</returns>
    Task<bool> IsNameExistsAsync(string name);

    /// <summary>
    /// 创建新角色
    /// </summary>
    /// <param name="role">角色信息</param>
    /// <returns>创建的角色</returns>
    Task<Role> CreateRoleAsync(Role role);
}